<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div id="main_synQuery_list" class="easyui-layout" fit="true">
    <div region="north" style="padding:0px;border:0px">
         <table style="width: 100%;" cellpadding="0" cellspacing="1"  border="0" class="formtable" align="center">
	       <tr height="40" >
				<td>
				    <label style="padding:2px;"> 工单来源  </label>
				    <select name="woSrc" id="woSrc" style="margin-left:5px;width:120px;" >
					         <option value="">请选择</option>			                                 
					         <option value="A01">95598工单</option>
                              <option value="A02">增值服务</option>
				    </select>
				    <select name="pmd" id="pmd" style="width:90px;">
				         <option value="contactMan">联系人</option>
				         <option value="contactPhone">联系电话</option>
				         <option value="doUsername">处理人员</option>
				         <option value="id">工单编号</option>	
				        
			        </select>
			        <input type="text" name="pmv" id="pmv" style="width:120px;">
			        <label style="padding:2px;"> 创建日期 从  </label> 
			        <input class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 100px;" id="startDate"
						      				 name="startDate" ignore="ignore" value=""> 至 
				    <input class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 100px;" id="endDate"
						      				 name="endDate" ignore="ignore" value=""> 
			      <!--         
			        <label style="padding:2px;"> 工单状态   </label>
			        <t:dictSelect field="woState" id="woState" typeGroupCode="woState" hasLabel="false" defaultVal="" ></t:dictSelect>
			       
			        <label style="padding:2px;"> 部门   </label>
			        <input id="zDepartname" name="zDepartname" type="text" style="height:30px;width:120px;" readonly="readonly" class="inputxt"   onclick="openZDepartmentSelect();" value="">
	                <input id="zOrgIds" name="zOrgIds" type="hidden" value="">
	               -->  
	                <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-search"  style="margin-left:5px;" onclick="myquery();" >查 询</a>
	                <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-cancel"  style="margin-left:5px;" onclick="myreset();" >清 空</a>
				</td>
				
			</tr>
		 </table>
	   </div>
	   <div region="center" style="padding:0px;border:0px">
	        <t:datagrid name="synQueryList" title="工单综合查询"
	                    actionUrl="woController.do?synQueryListGrid"
	                   treegrid="false" idField="id" pagination="true" sortOrder="desc" sortName="createDatetime" onLoadSuccess="" pageSize="15">
	            <t:dgCol title="工单来源" field="woSrcDesc" width="60" ></t:dgCol>
	            <t:dgCol title="编号" field="id" width="60" hidden="true"></t:dgCol>
	            <t:dgCol title="工单编号" field="wo95598Id" width="100" ></t:dgCol>
		        <t:dgCol title="联系人 " field="contactMan" width="80" ></t:dgCol>
		        <t:dgCol title="联系电话 " field="contactPhone" width="80" ></t:dgCol>
		        <t:dgCol title="工单状态" field="woStateDesc" width="60" ></t:dgCol>
		        <t:dgCol title="处理人员" field="doUsername" width="60" ></t:dgCol>
		        <t:dgCol title="创建时间 " field="createDatetime"  width="80" formatter="yyyy.MM.dd hh:mm:ss"></t:dgCol>
		        <t:dgCol title="common.operation" field="opt" width="90"></t:dgCol>
	            <t:dgFunOpt funname="showWoDetail(id)" title="工单详情"></t:dgFunOpt>
	            <t:dgFunOpt funname="ExportXls(id)" title="导出"></t:dgFunOpt>
	            <t:dgFunOpt funname="PrintWoURL(id)" title="打印"></t:dgFunOpt>  
	        </t:datagrid>
      
    </div>
</div>

<script language="javascript" src="plug-in/lodop/LodopFuncs.js"></script>
<script type="text/javascript">
    var LODOP; //声明为全局变量 
	$(function() {
		
	    $('#synQueryList').datagrid({  
		   onDblClickRow: function (rowIndex, rowData) {  
			   showWoDetail(rowData.id);
		   }
	   });
	    
	});

    function showWoDetail(id){
	  createdetailwindow("工单详情","woController.do?woDetailTabs&wo_id=" + id,1210,600);
		 
    }
	
	function openZDepartmentSelect() {
		$.dialog.setting.zIndex = 9999; 
		
		var orgIds = $("#zOrgIds").val();
		
		$.dialog({content: 'url:departController.do?departSelect&orgIds='+orgIds, zIndex: 2100, title: '组织机构列表', lock: true, width: '400px', height: '350px', opacity: 0.4, button: [
		   {name: '<t:mutiLang langKey="common.confirm"/>', callback: callbackZDepartmentSelect, focus: true},
		   {name: '<t:mutiLang langKey="common.cancel"/>', callback: function (){}}
	   ]}).zindex();
	}
	
	function callbackZDepartmentSelect() {
		  var iframe = this.iframe.contentWindow;
		  var treeObj = iframe.$.fn.zTree.getZTreeObj("departSelect");
		  var nodes = treeObj.getCheckedNodes(true);
		  if(nodes.length>0){
		  var ids='',names='';
		  for(i=0;i<nodes.length;i++){
		     var node = nodes[i];
		     ids += node.id+',';
		    names += node.name+',';
		 }
		 $('#zDepartname').val(names);
		 $('#zDepartname').blur();		
		 $('#zOrgIds').val(ids);		
		}
	}
	
	function myquery(){
		 //字段选项
	    var pmd = $('#pmd').val();
		 //字段值
	    var pmv = $('#pmv').val();
		 //工单状态
	    // var woState = $('#woState').val();
	     //工单来源
	    var woSrc = $('#woSrc').val();
		 //部门
	    // var zOrgIds = $('#zOrgIds').val();
		 
	    //开始日期
	    var startDate = $('#startDate').val();
		 //结束日期
	    var endDate = $('#endDate').val();
		
		$('#synQueryList').datagrid({
			queryParams: {
				pmd: pmd,
				pmv: pmv,
				//woState: woState,
				woSrc:woSrc,
				//zOrgIds: zOrgIds
				startDate:startDate,
				endDate:endDate
			}
		});

	}
	
	function myreset(){
		$('#woSrc').val('');
		$('#pmv').val('');
		$('#startDate').val('');
		$('#endDate').val('');
	}
	
	//导出
	function ExportXls(id) {
		
		JeecgExcelExport("woController.do?exportWoXls&wo_id=" + id, "synQueryList");
	}
	function PrintWoURL(id){
		 LODOP=getLodop();  
		LODOP.PRINT_INIT("工单打印");
		//LODOP.SET_PRINT_PAGESIZE(1,"95%","95%",0,"A4");
		LODOP.ADD_PRINT_URL(20,20,"90%","90%","woController.do?woPrint&wo_id=" + id);
		//LODOP.SET_PREVIEW_WINDOW(2,0,0,0,0,""); //按适宽模式显示

	//	LODOP.SET_PRINT_STYLEA(0,"HOrient",3);
	//	LODOP.SET_PRINT_STYLEA(0,"VOrient",3);
//		LODOP.SET_SHOW_MODE("MESSAGE_GETING_URL",""); //该语句隐藏进度条或修改提示信息
//		LODOP.SET_SHOW_MODE("MESSAGE_PARSING_URL","");//该语句隐藏进度条或修改提示信息
		LODOP.PREVIEW();  			
	};
	
</script>